package dao.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Store {

	private long id;
	private String name;
	private String address;
	private String telephone;
	private Set<User> users = new HashSet<User>();
	private Set<Deposit> deposits = new HashSet<Deposit>();

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@ManyToMany(targetEntity = User.class)
	@JoinTable(name = "re_store_user", joinColumns = { @JoinColumn(name = "storeId") }, inverseJoinColumns = { @JoinColumn(name = "userId") })
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	@ManyToMany(targetEntity = Deposit.class)
	@JoinTable(name = "re_store_deposit", joinColumns = { @JoinColumn(name = "storeId") }, inverseJoinColumns = { @JoinColumn(name = "depositId") })
	public Set<Deposit> getDeposits() {
		return deposits;
	}

	public void setDeposits(Set<Deposit> deposits) {
		this.deposits = deposits;
	}

}
